package tp.pr5.items;

import tp.pr5.NavigationModule;
import tp.pr5.RobotEngine;

/**
 * The superclass of every type of item. It contains the common information for all the items and it defines the interface that the items must match
 * @author usuario_local
 *
 */
public abstract class Item {
	private String id;
	private String description;
	/**
	 * Item class constructor
	 * @param id
	 * @param description
	 */
	public Item(String id, String description){ //constructora
		this.id = id;
		this.description = description;
		
	}
	/**
	 * Checks if the item can be used. Subclasses must override this method
	 * @return
	 */
	public abstract boolean canBeUsed();
	/**
	 * Try to use the item with a robot in a given place. It returns whether the action was completed. Subclasses must override this method
	 * @param r
	 * @param p
	 * @return
	 */
	//public abstract boolean use(RobotEngine r, Place p);
	
	/**
	 * Return the item identifier
	 * @return
	 */
	public String getId(){
		return this.id;
	}
	/**
	 * Return description
	 * @return
	 */
	public String getDescription(){
		return this.description;
	}
	/**
	 * Generates a String with the Item description
	 */
	public String toString(){
		return this.description;
	}
	/**
	 * Try to use the item with a robot in a given place. It returns whether the action was completed. Subclasses must override this method
	 * @param r
	 * @param p
	 * @return
	 */
	public abstract boolean use(RobotEngine r, NavigationModule nav);
	/**
	 * Tries to undo the last time it was used
	 * @param r
	 * @param nav
	 * @return
	 */
	public abstract boolean unUse(RobotEngine r, NavigationModule nav);
	
}
